<script setup>
import axios from "axios";
import * as Cesium from "cesium";
import { onMounted, onBeforeUnmount, ref } from "vue";
//模型实例
let viewer;
let AreaPointList,
  polygonFc = [],
  floorsopList = [],
  videoListIcons = [],
  dataJson = "";
let videoMap = new Map();
let peopleMap = new Map();
let floorTmepHeight = 3.5;
let memberFloorHeight = 0.1;
let polygonList = new Map();
let centerDialogVisible = ref(false);
let code = ref(null);
let handler = null;
let getWorkshopList = [
  {
    id: 21,
    workno: "999999999",
    workname: "厂区道路",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: null,
    remarks: null,
    upperLimit: 0,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: null,
    czgLimit: 0,
    spacing: null,
    basement: null,
    color: null,
    gwbind: null,
    areaColor: null,
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: null,
    type: null,
    layernum: null,
  },
  {
    id: 42,
    workno: "1",
    workname: "丙烷压缩机",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-07-16 16:40:22",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ff9800",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 43,
    workno: "2",
    workname: "10KV变配电室",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:18:33",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 44,
    workno: "3",
    workname: "中控楼",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-11 13:34:24",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: 0,
    spacing: 0,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: 0,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: null,
    layernum: "0",
  },
  {
    id: 45,
    workno: "4",
    workname: "应急库房",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-11 13:34:34",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: 0,
    spacing: 0,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: 0,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: null,
    layernum: "0",
  },
  {
    id: 46,
    workno: "5",
    workname: "脱水脱氢装置区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:19:08",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ff9800",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 47,
    workno: "6",
    workname: "凝析油罐",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:19:24",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ea1100",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 48,
    workno: "7",
    workname: "甲醇罐",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:19:34",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ea1100",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 49,
    workno: "8",
    workname: "原料水罐",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:19:49",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ea1100",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 50,
    workno: "9",
    workname: "甲醇回收装置区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:20:37",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 51,
    workno: "10",
    workname: "渗滤池",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:20:52",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 52,
    workno: "11",
    workname: "锅炉房",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:21:01",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 53,
    workno: "12",
    workname: "消防泵房",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:21:14",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 54,
    workno: "13",
    workname: "进站区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:21:26",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ff9800",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 55,
    workno: "14",
    workname: "机房",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:21:39",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 56,
    workno: "15",
    workname: "集气区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:21:58",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ff9800",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 57,
    workno: "16",
    workname: "陕京二线外输区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:22:05",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ff9800",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 58,
    workno: "17",
    workname: "进站区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:26:03",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ff9800",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 59,
    workno: "18",
    workname: "进站截断区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:22:32",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ff9800",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 60,
    workno: "19",
    workname: "装卸车区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 18:20:07",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ea1100",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 61,
    workno: "21",
    workname: "机房",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 18:43:58",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: 0,
    spacing: 0,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: 0,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 1,
    layernum: null,
  },
  {
    id: 62,
    workno: "22",
    workname: "循环水房/锅炉房辅助间",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 18:48:34",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: 0,
    spacing: 0,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: 0,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 63,
    workno: "23",
    workname: "工具室",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 18:48:46",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: 0,
    spacing: 0,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: 0,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 64,
    workno: "24",
    workname: "回注间/配电室",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:23:39",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 65,
    workno: "25",
    workname: "新回注间",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-10-20 16:54:15",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 66,
    workno: "26",
    workname: "空氮站",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:23:59",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 67,
    workno: "27",
    workname: "天然气分液罐",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:24:16",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 68,
    workno: "28",
    workname: "甲醇储罐/丙烷储罐",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-07-20 16:12:11",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#ea1100",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 69,
    workno: "29",
    workname: "回注井",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:24:36",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 70,
    workno: "30",
    workname: "二配机柜间",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-10-20 17:24:42",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 71,
    workno: "31",
    workname: "回注罐区",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-10-20 17:32:44",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#FCFF00",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 72,
    workno: "32",
    workname: "发电机房",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-10-20 17:03:45",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 73,
    workno: "33",
    workname: "教育室",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-10-20 17:30:19",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: null,
    spacing: null,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: null,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
  {
    id: 74,
    workno: "35",
    workname: "食堂",
    worklevel: "常规区域",
    isvalid: 0,
    lasttime: "2022-06-23 19:14:40",
    remarks: "",
    upperLimit: 15,
    morelong: 0,
    longtype: 0,
    moreshort: 0,
    shorttype: 0,
    morestatic: 0,
    workdescribe: "",
    czgLimit: 0,
    spacing: 0,
    basement: 0,
    color: null,
    gwbind: null,
    areaColor: "#0024ff",
    lessLimit: 0,
    leavetime: null,
    offlineTime: null,
    lineControl: 0,
    work3Durl: "",
    type: 0,
    layernum: null,
  },
];
//
const getAreaPointFn = () => {
  viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  // let result = await axios.post('http://10.59.30.132:8889/CQYT/open/information/getArea.do');
  // AreaPointList = result.data.data.rows;
  AreaPointList = {
    "42_丙烷压缩机": [
      {
        latitude: 38.274980927670335,
        x: 1042.711923936334,
        y: 2490.4683720930234,
        longitude: 109.53789353135346,
        order: 1,
      },
      {
        latitude: 38.27524832895937,
        x: 1026.7274276091189,
        y: 2045.6162126245847,
        longitude: 109.5378776080197,
        order: 2,
      },
      {
        latitude: 38.27523801470005,
        x: 726.3898000773218,
        y: 2059.187973421927,
        longitude: 109.53765000371116,
        order: 3,
      },
      {
        latitude: 38.27497638868173,
        x: 738.4033051785938,
        y: 2494.3891029900333,
        longitude: 109.53766283366168,
        order: 4,
      },
    ],
    "66_空氮站": [
      {
        latitude: 38.274790962362374,
        x: 3622.5997141109606,
        y: 2837.1122299651565,
        longitude: 109.53985260369265,
        order: 1,
      },
      {
        latitude: 38.27482676891265,
        x: 3840.567822058815,
        y: 2780.167546337158,
        longitude: 109.54001738337972,
        order: 2,
      },
      {
        latitude: 38.27468957091009,
        x: 3908.2322604567603,
        y: 3009.120635481024,
        longitude: 109.54007064517654,
        order: 3,
      },
      {
        latitude: 38.27465271649958,
        x: 3697.266640205976,
        y: 3067.8912709620477,
        longitude: 109.53991119048996,
        order: 4,
      },
    ],
    "50_甲醇回收装置区": [
      {
        latitude: 38.275147417503646,
        x: 2269.6231074948164,
        y: 2228.236363636364,
        longitude: 109.5388215510524,
        order: 1,
      },
      {
        latitude: 38.27516460579801,
        x: 2764.567015552089,
        y: 2205.5533449477352,
        longitude: 109.53919663076519,
        order: 2,
      },
      {
        latitude: 38.2750234674464,
        x: 2772.3724571428575,
        y: 2440.3453620692426,
        longitude: 109.53920455652612,
        order: 3,
      },
      {
        latitude: 38.27501479150569,
        x: 2279.398195102335,
        y: 2448.896663724625,
        longitude: 109.53883084939596,
        order: 4,
      },
    ],
    "69_回注井": [
      {
        latitude: 38.27577254476827,
        x: 4022.8322188700517,
        y: 1209.6092334494772,
        longitude: 109.54014215001773,
        order: 1,
      },
      {
        latitude: 38.275788759528254,
        x: 4170.8634192604,
        y: 1184.4101393728222,
        longitude: 109.54025417396245,
        order: 2,
      },
      {
        latitude: 38.27572067000681,
        x: 4198.382039845785,
        y: 1297.9642160278745,
        longitude: 109.54027600991122,
        order: 3,
      },
      {
        latitude: 38.27570098461931,
        x: 4052.670416669531,
        y: 1328.9622648083623,
        longitude: 109.54016579428693,
        order: 4,
      },
    ],
    "73_教育室": [
      {
        latitude: 38.27472284641471,
        x: 2856.9296006350564,
        y: 2941.2559752868488,
        longitude: 109.53927295195841,
        order: 4,
      },
      {
        latitude: 38.27463604520249,
        x: 2363.754616489475,
        y: 3079.7194076655055,
        longitude: 109.53890020343633,
        order: 5,
      },
      {
        latitude: 38.27476358546675,
        x: 2302.3936880806777,
        y: 2866.9013062665495,
        longitude: 109.53885185901268,
        order: 6,
      },
      {
        latitude: 38.27484727849879,
        x: 2789.6257187472256,
        y: 2733.5356310679617,
        longitude: 109.53922014508888,
        order: 7,
      },
    ],
    "51_渗滤池": [
      {
        latitude: 38.27589863048653,
        x: 3343.5243465326425,
        y: 991.8443853820597,
        longitude: 109.53962522694749,
        order: 1,
      },
      {
        latitude: 38.275922867771136,
        x: 3549.4127017410506,
        y: 953.9942524916943,
        longitude: 109.53978101085627,
        order: 2,
      },
      {
        latitude: 38.275704844338506,
        x: 3571.831209168529,
        y: 1316.812657807309,
        longitude: 109.5398011111307,
        order: 3,
      },
      {
        latitude: 38.27569479281671,
        x: 3358.7548571840457,
        y: 1330.987607973422,
        longitude: 109.53963967474645,
        order: 4,
      },
    ],
    "43_10KV变配电室": [
      {
        latitude: 38.274723475596055,
        x: 589.5416360275169,
        y: 2913.183972125436,
        longitude: 109.5375535454382,
        order: 1,
      },
      {
        latitude: 38.27477563827128,
        x: 883.1790242662067,
        y: 2829.942613240418,
        longitude: 109.53777547382622,
        order: 2,
      },
      {
        latitude: 38.27467414557423,
        x: 926.9490285714285,
        y: 2999.236540102046,
        longitude: 109.53781010840729,
        order: 3,
      },
      {
        latitude: 38.27461722953816,
        x: 640.9940760492335,
        y: 3090.4738327526134,
        longitude: 109.53759407332196,
        order: 4,
      },
    ],
    "62_循环水房/锅炉房辅助间": [
      {
        latitude: 38.275511005692444,
        x: 2978.677515550008,
        y: 1632.0769726390115,
        longitude: 109.53935406901398,
        order: 1,
      },
      {
        latitude: 38.275561837019836,
        x: 3087.6208602786046,
        y: 1548.8480836236936,
        longitude: 109.53943595980171,
        order: 2,
      },
      {
        latitude: 38.27555999166072,
        x: 3194.8912361146654,
        y: 1553.1953221535746,
        longitude: 109.53951733092957,
        order: 3,
      },
      {
        latitude: 38.27521596727347,
        x: 3212.0377012622794,
        y: 2125.4778905560456,
        longitude: 109.53953522486381,
        order: 4,
      },
      {
        latitude: 38.27520856110207,
        x: 3116.1938341431232,
        y: 2136.6512195121954,
        longitude: 109.53946265018766,
        order: 5,
      },
      {
        latitude: 38.275041411502265,
        x: 3122.941695129578,
        y: 2414.684738675958,
        longitude: 109.53947014380702,
        order: 6,
      },
      {
        latitude: 38.27503809036682,
        x: 3000.1622557744777,
        y: 2418.744006968641,
        longitude: 109.53937708536074,
        order: 7,
      },
    ],
    "71_回注罐区": [
      {
        latitude: 38.27553088336977,
        x: 3325.172321768967,
        y: 1603.1523654015887,
        longitude: 109.53961653909322,
        order: 1,
      },
      {
        latitude: 38.27553665097185,
        x: 3551.721995623541,
        y: 1596.2617387466903,
        longitude: 109.53978825342959,
        order: 2,
      },
      {
        latitude: 38.27531250222947,
        x: 3568.347656923214,
        y: 1969.196875551633,
        longitude: 109.53980404798585,
        order: 3,
      },
      {
        latitude: 38.275306174087106,
        x: 3327.4558463330186,
        y: 1976.8486760812004,
        longitude: 109.53962146574139,
        order: 4,
      },
    ],
    "72_发电机房": [
      {
        latitude: 38.27568527941147,
        x: 5135.346172244102,
        y: 1367.983222591362,
        longitude: 109.54098702841732,
        order: 1,
      },
      {
        latitude: 38.27569212356455,
        x: 5267.846588340138,
        y: 1358.1813953488372,
        longitude: 109.54108740834829,
        order: 2,
      },
      {
        latitude: 38.27562922391258,
        x: 5272.672096665335,
        y: 1462.8347508305649,
        longitude: 109.5410919619451,
        order: 3,
      },
      {
        latitude: 38.2756243478818,
        x: 5149.06871154388,
        y: 1469.469833887043,
        longitude: 109.54099830079538,
        order: 4,
      },
    ],
    "44_中控楼": [
      {
        latitude: 38.27465126744381,
        x: 1267.5962298382942,
        y: 3041.340871080139,
        longitude: 109.53806875207214,
        order: 1,
      },
      {
        latitude: 38.27477587329802,
        x: 1950.922590044739,
        y: 2842.2785714285715,
        longitude: 109.5385851579864,
        order: 2,
      },
      {
        latitude: 38.27461984574288,
        x: 2023.2512249932997,
        y: 3102.5989198606267,
        longitude: 109.5386422244469,
        order: 3,
      },
      {
        latitude: 38.27452171304814,
        x: 1494.9675144834412,
        y: 3259.4870034843207,
        longitude: 109.53824301351628,
        order: 4,
      },
      {
        latitude: 38.274341925088585,
        x: 1578.4195765268607,
        y: 3559.451114982579,
        longitude: 109.53830885289017,
        order: 5,
      },
      {
        latitude: 38.27431147149705,
        x: 1434.184047941393,
        y: 3608.373205574913,
        longitude: 109.53819990971967,
        order: 6,
      },
    ],
    "56_集气区": [
      {
        latitude: 38.27539736771568,
        x: 4684.597054518215,
        y: 1841.3789895470386,
        longitude: 109.5406493116033,
        order: 1,
      },
      {
        latitude: 38.27541275642373,
        x: 5327.502869766397,
        y: 1823.4521094439542,
        longitude: 109.54113661885043,
        order: 2,
      },
      {
        latitude: 38.27497813350436,
        x: 5497.244862360886,
        y: 2548.209823477494,
        longitude: 109.54127151665132,
        order: 3,
      },
      {
        latitude: 38.27495347219667,
        x: 4722.008303782661,
        y: 2579.9788172992057,
        longitude: 109.54068399266757,
        order: 4,
      },
    ],
    "74_食堂": [
      {
        latitude: 38.27427124411486,
        x: 594.2335081196611,
        y: 3665.255679442509,
        longitude: 109.5375635333851,
        order: 1,
      },
      {
        latitude: 38.27437055920297,
        x: 1119.4068764560755,
        y: 3506.3643205574913,
        longitude: 109.53796036888032,
        order: 2,
      },
      {
        latitude: 38.274267003684606,
        x: 1170.2794221742688,
        y: 3679.173170731707,
        longitude: 109.53800041876542,
        order: 3,
      },
      {
        latitude: 38.27417020815479,
        x: 642.7864766237606,
        y: 3833.8471080139375,
        longitude: 109.53760178847249,
        order: 4,
      },
    ],
    "54_进站区": [
      {
        latitude: 38.275158575132124,
        x: 4153.006342857143,
        y: 2232.13100162565,
        longitude: 109.54024959288259,
        order: 1,
      },
      {
        latitude: 38.27517262273768,
        x: 4537.620207407001,
        y: 2213.355574912892,
        longitude: 109.54054105216501,
        order: 2,
      },
      {
        latitude: 38.27494568743675,
        x: 4541.378114285714,
        y: 2590.7711052809477,
        longitude: 109.54054712851202,
        order: 3,
      },
      {
        latitude: 38.27493784503988,
        x: 4158.266457142857,
        y: 2599.2457950393537,
        longitude: 109.54025672014984,
        order: 4,
      },
    ],
    "46_脱水脱氢装置区": [
      {
        latitude: 38.27500046732338,
        x: 2027.5548857142853,
        y: 2469.7145455423392,
        longitude: 109.53864007614104,
        order: 1,
      },
      {
        latitude: 38.27550144258199,
        x: 1996.5055999999997,
        y: 1636.272642405318,
        longitude: 109.53860940787388,
        order: 2,
      },
      {
        latitude: 38.2754885530565,
        x: 1497.6714285714286,
        y: 1651.7608685155083,
        longitude: 109.53823131698864,
        order: 3,
      },
      {
        latitude: 38.27526793000158,
        x: 1509.359436743614,
        y: 2018.7742857142857,
        longitude: 109.53824331711161,
        order: 4,
      },
      {
        latitude: 38.27525408588198,
        x: 1161.3174193016337,
        y: 2037.6472473867595,
        longitude: 109.53797958796892,
        order: 5,
      },
      {
        latitude: 38.27496824064541,
        x: 1172.3479714285713,
        y: 2513.1108017190045,
        longitude: 109.53799201688939,
        order: 6,
      },
    ],
    "64_回注间/配电室": [
      {
        latitude: 38.27539899129886,
        x: 3628.921150622262,
        y: 1826.096187113857,
        longitude: 109.53984875212302,
        order: 1,
      },
      {
        latitude: 38.275401814310406,
        x: 3774.637456962017,
        y: 1823.1386411149824,
        longitude: 109.53995921105519,
        order: 2,
      },
      {
        latitude: 38.2751073671779,
        x: 3788.4494849186663,
        y: 2312.9394425087107,
        longitude: 109.53997387152,
        order: 3,
      },
      {
        latitude: 38.27510332959603,
        x: 3593.8269836378927,
        y: 2317.3337687555168,
        longitude: 109.53982634348537,
        order: 4,
      },
      {
        latitude: 38.275150170075946,
        x: 3591.383211736013,
        y: 2239.413601059135,
        longitude: 109.53982382433472,
        order: 5,
      },
      {
        latitude: 38.27515579963501,
        x: 3644.0645240470235,
        y: 2230.68013239188,
        longitude: 109.53986369339653,
        order: 6,
      },
    ],
    "68_甲醇储罐/丙烷储罐": [
      {
        latitude: 38.275102858504034,
        x: 371.06148392296654,
        y: 2279.703953488372,
        longitude: 109.53738247411601,
        order: 1,
      },
      {
        latitude: 38.27511575973312,
        x: 627.4668794107818,
        y: 2261.306677740864,
        longitude: 109.537576727108,
        order: 2,
      },
      {
        latitude: 38.275026772388244,
        x: 627.9192708162691,
        y: 2409.2891362126247,
        longitude: 109.53757833542447,
        order: 3,
      },
      {
        latitude: 38.2750136944763,
        x: 372.1673295808243,
        y: 2427.9880066445185,
        longitude: 109.53738458046973,
        order: 4,
      },
    ],
    "58_进站区": [
      {
        latitude: 38.275453264881186,
        x: 5557.537923218734,
        y: 1758.8324536628418,
        longitude: 109.54131048224693,
        order: 1,
      },
      {
        latitude: 38.2757937140803,
        x: 7024.64236287008,
        y: 1210.1863371579875,
        longitude: 109.5424181710116,
        order: 2,
      },
      {
        latitude: 38.275411596860344,
        x: 7353.790394769139,
        y: 1849.5323300970874,
        longitude: 109.54267320248428,
        order: 3,
      },
      {
        latitude: 38.275055056317065,
        x: 5796.186271079336,
        y: 2423.8580494263015,
        longitude: 109.5414971151149,
        order: 4,
      },
    ],
    "59_进站截断区": [
      {
        latitude: 38.274583623913074,
        x: 4283.3402857142855,
        y: 3189.7709443255167,
        longitude: 109.54035660215997,
        order: 1,
      },
      {
        latitude: 38.275328771353905,
        x: 7456.2119999999995,
        y: 1988.4836710714803,
        longitude: 109.5427520481205,
        order: 2,
      },
      {
        latitude: 38.2751795596011,
        x: 7576.7868534156505,
        y: 2238.0450834260287,
        longitude: 109.5428456035717,
        order: 3,
      },
      {
        latitude: 38.2744355976648,
        x: 4355.0824,
        y: 3436.778927714916,
        longitude: 109.54041311008618,
        order: 4,
      },
    ],
    "49_原料水罐": [
      {
        latitude: 38.27544121518874,
        x: 2288.044931819224,
        y: 1739.899734219269,
        longitude: 109.53883134328188,
        order: 1,
      },
      {
        latitude: 38.27545566499055,
        x: 2722.541743933844,
        y: 1721.0500664451827,
        longitude: 109.53916062390502,
        order: 2,
      },
      {
        latitude: 38.275235965662134,
        x: 2738.878100243105,
        y: 2086.582823920266,
        longitude: 109.53917613581285,
        order: 3,
      },
      {
        latitude: 38.27521978206797,
        x: 2302.873316776861,
        y: 2108.2976411960135,
        longitude: 109.53884573632207,
        order: 4,
      },
    ],
    "53_消防泵房": [
      {
        latitude: 38.27479792888469,
        x: 3164.6445510995986,
        y: 2820.0690820829655,
        longitude: 109.53950522970975,
        order: 1,
      },
      {
        latitude: 38.27485299060768,
        x: 3556.2890447516443,
        y: 2733.1750750220654,
        longitude: 109.53980143727732,
        order: 2,
      },
      {
        latitude: 38.27464287222156,
        x: 3661.5715457047513,
        y: 3083.8358605472195,
        longitude: 109.53988426228311,
        order: 3,
      },
      {
        latitude: 38.274573022902935,
        x: 3270.5680414040185,
        y: 3195.327802294793,
        longitude: 109.53958875104475,
        order: 4,
      },
    ],
    "52_锅炉房": [
      {
        latitude: 38.27520314352456,
        x: 3129.9531444358163,
        y: 2145.824111498258,
        longitude: 109.53947316112834,
        order: 1,
      },
      {
        latitude: 38.275217178827376,
        x: 3416.2100597205713,
        y: 2125.896794425087,
        longitude: 109.53969003489387,
        order: 2,
      },
      {
        latitude: 38.275048238105306,
        x: 3429.6003463655666,
        y: 2406.987944250871,
        longitude: 109.53970259104078,
        order: 3,
      },
      {
        latitude: 38.275038542579004,
        x: 3138.4406883328415,
        y: 2419.6402090592337,
        longitude: 109.53948193774,
        order: 4,
      },
    ],
    "47_凝析油罐": [
      {
        latitude: 38.27578407973837,
        x: 1527.67551061864,
        y: 1160.6871428571428,
        longitude: 109.53824986765099,
        order: 1,
      },
      {
        latitude: 38.27579846086263,
        x: 1927.2879187990227,
        y: 1141.5358803986712,
        longitude: 109.53855269583353,
        order: 2,
      },
      {
        latitude: 38.27565786183567,
        x: 1938.597703936203,
        y: 1375.4728239202657,
        longitude: 109.53856327132743,
        order: 3,
      },
      {
        latitude: 38.27564294237606,
        x: 1539.7895471433533,
        y: 1395.5288704318937,
        longitude: 109.53826106067623,
        order: 4,
      },
    ],
    "48_甲醇罐": [
      {
        latitude: 38.275806873820585,
        x: 2164.793406679816,
        y: 1130.376877076412,
        longitude: 109.538732680531,
        order: 1,
      },
      {
        latitude: 38.27583693613137,
        x: 3035.7473936661668,
        y: 1090.7674418604652,
        longitude: 109.53939271182071,
        order: 2,
      },
      {
        latitude: 38.27568936637669,
        x: 3048.715947290134,
        y: 1336.3157807308971,
        longitude: 109.53940464429886,
        order: 3,
      },
      {
        latitude: 38.27567144125907,
        x: 2179.9736516194985,
        y: 1355.7686378737542,
        longitude: 109.53874611759917,
        order: 4,
      },
    ],
    "60_装卸车区": [
      {
        latitude: 38.27576221026087,
        x: 404.9770945151913,
        y: 1183.6720905923346,
        longitude: 109.53739881793221,
        order: 1,
      },
      {
        latitude: 38.275770989356445,
        x: 643.4718062551972,
        y: 1171.9160278745644,
        longitude: 109.5375795475685,
        order: 2,
      },
      {
        latitude: 38.27555499984315,
        x: 665.3496367972182,
        y: 1531.3457839721257,
        longitude: 109.5375992089196,
        order: 3,
      },
      {
        latitude: 38.275546076023616,
        x: 406.664059761805,
        y: 1543.1018466898954,
        longitude: 109.53740317027592,
        order: 4,
      },
    ],
    "70_二配机柜间": [
      {
        latitude: 38.27562273701458,
        x: 5130.973055324391,
        y: 1471.932857142857,
        longitude: 109.54098460146575,
        order: 4,
      },
      {
        latitude: 38.27560724587874,
        x: 4665.0601733842705,
        y: 1492.139700996678,
        longitude: 109.54063151232646,
        order: 5,
      },
      {
        latitude: 38.275670888688815,
        x: 4666.92000471794,
        y: 1386.3302325581396,
        longitude: 109.54063201776609,
        order: 6,
      },
      {
        latitude: 38.27568426012928,
        x: 5115.4409504026635,
        y: 1369.4409302325582,
        longitude: 109.5409719484529,
        order: 7,
      },
    ],
    "57_陕京二线外输区": [
      {
        latitude: 38.276135947382436,
        x: 5601.4056319491965,
        y: 624.1225154457193,
        longitude: 109.54133404117613,
        order: 1,
      },
      {
        latitude: 38.2763226216206,
        x: 6650.172542857143,
        y: 326.202498028296,
        longitude: 109.54212668415343,
        order: 2,
      },
      {
        latitude: 38.27597319655616,
        x: 6907.100940573117,
        y: 910.3238923212709,
        longitude: 109.54232648545884,
        order: 3,
      },
      {
        latitude: 38.27573210393712,
        x: 5867.296027240585,
        y: 1298.84306266549,
        longitude: 109.54154141225577,
        order: 4,
      },
    ],
    "65_新回注间": [
      {
        latitude: 38.27557080447932,
        x: 3590.902469722528,
        y: 1539.9348720211826,
        longitude: 109.53981747901794,
        order: 1,
      },
      {
        latitude: 38.275576028573646,
        x: 3762.775982571765,
        y: 1533.2963414634148,
        longitude: 109.53994773925027,
        order: 2,
      },
      {
        latitude: 38.2754360908506,
        x: 3766.677089704559,
        y: 1766.0452961672474,
        longitude: 109.53995268721913,
        order: 3,
      },
      {
        latitude: 38.275433859178975,
        x: 3596.3508792086864,
        y: 1767.7261694616063,
        longitude: 109.53982355778405,
        order: 4,
      },
    ],
    "45_应急库房": [
      {
        latitude: 38.27454822120657,
        x: 2588.120994289092,
        y: 3228.4362369337978,
        longitude: 109.5390715928693,
        order: 1,
      },
      {
        latitude: 38.27461196241272,
        x: 2926.9901382026105,
        y: 3126.480069686411,
        longitude: 109.53932765661277,
        order: 2,
      },
      {
        latitude: 38.27450751352299,
        x: 2972.6436351890925,
        y: 3300.712299651568,
        longitude: 109.53936376150976,
        order: 3,
      },
      {
        latitude: 38.27444144565619,
        x: 2640.891375909725,
        y: 3406.6222996515685,
        longitude: 109.53911312769839,
        order: 4,
      },
    ],
    "63_工具室": [
      {
        latitude: 38.2750938507188,
        x: 3592.304633928525,
        y: 2333.078049426302,
        longitude: 109.53982532383733,
        order: 1,
      },
      {
        latitude: 38.27509909212004,
        x: 3788.3440495907525,
        y: 2326.698780487805,
        longitude: 109.53997390922503,
        order: 2,
      },
      {
        latitude: 38.27505958568134,
        x: 3786.2840363695236,
        y: 2392.3694880847306,
        longitude: 109.5399729088028,
        order: 3,
      },
      {
        latitude: 38.275054591342375,
        x: 3597.0319303944557,
        y: 2398.418817299206,
        longitude: 109.53982946683081,
        order: 4,
      },
    ],
    "67_天然气分液罐": [
      {
        latitude: 38.275221999122955,
        x: 368.64872976036804,
        y: 2081.556245847176,
        longitude: 109.53737895049193,
        order: 1,
      },
      {
        latitude: 38.2752203310514,
        x: 557.6478058305867,
        y: 2086.582823920266,
        longitude: 109.53752229531622,
        order: 2,
      },
      {
        latitude: 38.27513142614004,
        x: 561.1664056510429,
        y: 2234.4647508305648,
        longitude: 109.53752622761687,
        order: 3,
      },
      {
        latitude: 38.27512573142458,
        x: 370.7633306073081,
        y: 2241.665017421603,
        longitude: 109.53738192280436,
        order: 4,
      },
    ],
  };
  // fcPoint(AreaPointList);

  for (var i in AreaPointList) {
    let _id = i;
    var area = polygonList.get(_id);
    var _data = AreaPointList[_id];
    var key = _id;
    if (area) {
    } else {
      setpolygonList(_data, key, _id);
    }
  }
  if(handler){
    handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK)//移除事件
  }
};  
function fcPoint(data) {
  for (var i in data) {
    let name = i.split("_");
    let areaName = name[1] ? name[1] : "无";
    if (data[i].length >= 3) {
      var centenArrs = [];
      for (var j in data[i]) {
        centenArrs.push(data[i][j]);
      }
      let cenPoint;
      cenPoint = getCenter(centenArrs);
      var polygonFcid = viewer.entities.add({
        type: "1",
        id: name[0] + 1,
        position: Cesium.Cartesian3.fromDegrees(
          Number(cenPoint[0]),
          Number(cenPoint[1]),
          35
        ),
        show: false,
        label: {
          // 文本。支持显式换行符“ \ n”
          text: "查看分层",
          // 字体样式，以CSS语法指定字体
          font: "5pt Source Han Sans CN",
          // 字体颜色
          fillColor: Cesium.Color.WHITE,
          // 背景颜色
          backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
          // 是否显示背景颜色
          showBackground: true,
          // 字体边框
          outline: true,
          // 字体边框颜色
          outlineColor: Cesium.Color.WHITE,
          // 字体边框尺寸
          outlineWidth: 10,
          // 应用于图像的统一比例。比例大于会1.0放大标签，而比例小于会1.0缩小标签。
          scale: 1.0,
          // 设置样式：FILL：填写标签的文本，但不要勾勒轮廓；OUTLINE：概述标签的文本，但不要填写；FILL_AND_OUTLINE：填写并概述标签文本。
          style: Cesium.LabelStyle.FILL_AND_OUTLINE,
          // 相对于坐标的水平位置
          verticalOrigin: Cesium.VerticalOrigin.CENTER,
          // 相对于坐标的水平位置
          horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
          // 该属性指定标签在屏幕空间中距此标签原点的像素偏移量
          pixelOffset: new Cesium.Cartesian2(0, -60),
          // 是否显示
          show: true,
        },
        billboard: {
          //图标
          image:
            "",
          width: 45,
          height: 85.4,
        },
      });
      polygonFc.push(polygonFcid);
    }
  }
}
function setpolygonList(data, key) {
  if (!data) {
    return false;
  }
  let _id = key;
  let name = key.split("_");
  let areaName = name[1] ? name[1] : "无";
  if (data.length >= 3) {
    var DegreesArray = [];
    var centenArrs = [];
    for (var j in data) {
      if (data[j].longitude == "NaN" || data[j].latitude == "NaN") {
        continue;
      }
      if (
        data[j].longitude != 0 &&
        data[j].longitude &&
        data[j].latitude != 0 &&
        data[j].latitude
      ) {
        DegreesArray.push(data[j].longitude, data[j].latitude);
        centenArrs.push(data[j]);
      }
    }
    let cenPoint;
    cenPoint = getCenter(centenArrs);

    let _data = dataJsonid(key);
    let _cons = workShopByNameId(key);
    let _colorMes = _cons.areaColor ? _cons.areaColor : "rgb(255,0,0)";
    let s0 = _data ? _data.count : "0";
    let areacount = s0 + "人" + "  查看";
    let imgs = getImg(areacount);
    if (DegreesArray.length < 8) {
      return false;
    }
    var polygonListid = viewer.entities.add({
      polygon: {
        hierarchy: new Cesium.PolygonHierarchy(
          Cesium.Cartesian3.fromDegreesArray(DegreesArray)
        ),
        perPositionHeight: true,
        //extrudedHeight: getParameterListData.areaheight,
        extrudedHeight: new Cesium.CallbackProperty(function () {
          return 11;
        }, false),
        material: Cesium.Color.fromCssColorString(_colorMes).withAlpha(0.5),
        outline: false,
        name: name[1],
        outlineColor: Cesium.Color.WHITE,
        disableDepthTestDistance: Number.POSITIVE_INFINITY, //透视效果
      },
      areadata: _data,
      id: _id + "_polygon",
      name: areaName,
      position: Cesium.Cartesian3.fromDegrees(
        Number(cenPoint[0]),
        Number(cenPoint[1]),
        11
      ),
      type: "2",
      show: true,
      label: {
        // 文本。支持显式换行符“ \ n”
        text: areaName,
        // 字体样式，以CSS语法指定字体
        font: "10pt Source Han Sans CN",
        // 字体颜色
        fillColor: Cesium.Color.WHITE,
        // 背景颜色
        backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
        // 是否显示背景颜色
        showBackground: true,
        // 字体边框
        outline: false,
        // 字体边框颜色
        outlineColor: Cesium.Color.WHITE,
        // 字体边框尺寸
        outlineWidth: 1,
        // 应用于图像的统一比例。比例大于会1.0放大标签，而比例小于会1.0缩小标签。
        scale: 1.0,
        // 设置样式：FILL：填写标签的文本，但不要勾勒轮廓；OUTLINE：概述标签的文本，但不要填写；FILL_AND_OUTLINE：填写并概述标签文本。
        style: Cesium.LabelStyle.FILL_AND_OUTLINE,
        // 相对于坐标的水平位置
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
        // 相对于坐标的水平位置
        horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
        // 该属性指定标签在屏幕空间中距此标签原点的像素偏移量
        pixelOffset: new Cesium.Cartesian2(-2, 0),
        // 是否显示
        show: true,
        eyeOffset: new Cesium.Cartesian3(0, 0, -100),
        disableDepthTestDistance: Number.POSITIVE_INFINITY, //透视效果
      },
    });
    polygonList.set(_id, polygonListid);
    viewer.scene.requestRender();
  }
}
function getImg(name) {
  var mcanvas = document.createElement("canvas");

  mcanvas.width = name.length * 11;
  mcanvas.height = 80;
  var ctx = mcanvas.getContext("2d");

  ctx.stroke();
  ctx.strokeStyle = "#148e3ff";
  ctx.strokeRect(0, 0, 100, 24);
  ctx.fillStyle = "rgba(0,0,0,.5)"; //背景色
  ctx.fillRect(0, 0, 100, 24);
  //画头像

  // var smg;
  // smg = imgArr[0];
  // ctx.drawImage(smg,2,2,20,20);

  //添加字体
  ctx.fillStyle = "#F2F2F2";
  ctx.font = "14px 微软雅黑";
  ctx.textAlign = "start";
  ctx.textBaseline = "top";
  ctx.fillText(name, 5, 6);
  return mcanvas;
}
function getCenter(pointArray) {
  ////console.log(JSON.stringify(pointArray));
  var sortedLongitudeArray = pointArray.map((item) => item.longitude).sort(); //首先对经度进行排序，红色部分是array中经度的名称
  var sortedLatitudeArray = pointArray.map((item) => item.latitude).sort(); //对纬度进行排序，红色部分是array中纬度的名称
  var centerLongitude = (
    (parseFloat(sortedLongitudeArray[0]) +
      parseFloat(sortedLongitudeArray[sortedLongitudeArray.length - 1])) /
    2
  ).toFixed(4);
  const centerLatitude = (
    (parseFloat(sortedLatitudeArray[0]) +
      parseFloat(sortedLatitudeArray[sortedLatitudeArray.length - 1])) /
    2
  ).toFixed(4);

  //如果经纬度在array中不是数字类型，需要转化为数字类型进行计算，如果是可以去掉parseFloat处理
  console.log(centerLongitude + "kkk" + centerLatitude);
  return [centerLongitude, centerLatitude];
}
function workShopByNameId(key) {
  let a = key.split("_");
  let id = a[0];
  for (var i in getWorkshopList) {
    if (getWorkshopList[i].id == id) {
      return getWorkshopList[i];
    }
  }
}
function dataJsonid(id) {
  for (var j in dataJson) {
    let area_name = dataJson[j].areaid + "_" + dataJson[j].areaname;
    if (area_name == id) {
      return dataJson[j];
    }
  }
}
/**
 * 获取人员实时定位
 */
let onlinePosition = [];
const getRealInformation = () => {
  axios
    .post(
      "http://10.59.30.132:8889/CQYT/open/information/getRealInformation.do",
      {
        username: "admin",
        password: "CQECYlclc@2022",
      }
    )
    .then((res) => {
      if (res.data.status == 0) {
        //过滤门岗区域
        onlinePosition = getOnlinePosition(res.data.data.list);
        renderPosition(onlinePosition);
      }
    });
};
/**
 * 屏蔽门岗处定位卡
 * @param {*} list
 */
const getOnlinePosition = function (list) {
  let data = list.filter((element) => {
    if (
      element.longitude >= 109.53854598 &&
      element.longitude <= 109.53885133 &&
      element.latitude >= 38.27420664 &&
      element.latitude <= 38.27424453
    ) {
      return false;
    } else {
      return true;
    }
  });
  return data;
};

let lastTime = {};
let positionProperties = {};
const time = 2;
const renderPosition = (list) => {
  list.forEach((element) => {
    if (!positionProperties[element.iccard]) {
      addWorkerPosition(element);
    } else {
      getPosition(time, element);
    }
  });
};
let personnel = null;
const addWorkerPosition = function (point) {
  positionProperties[point.iccard] = new Cesium.SampledPositionProperty();
  const start = Cesium.JulianDate.now();
  const position = Cesium.Cartesian3.fromDegrees(
    point.longitude,
    point.latitude,
    0
  );
  positionProperties[point.iccard].addSample(start, position);
  lastTime[point.iccard] = start;

  const entityOption = {
    id: point.iccard,
    name: "people",
    type: "cr",
    position: positionProperties[point.iccard],
    billboard: {
      // 图像地址，URI或Canvas的属性
      image:
        "",
      // 设置颜色和透明度
      color: Cesium.Color.WHITE.withAlpha(1),
      // 高度（以像素为单位）
      height: 30,
      // 宽度（以像素为单位）
      width: 20,
      // 逆时针旋转
      rotation: 0,
      label: point.iccard,
      // 大小是否以米为单位
      sizeInMeters: false,
      // 相对于坐标的垂直位置
      verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
      // 相对于坐标的水平位置
      // horizontalOrigin: HorizontalOrigin.LEFT,
      // 该属性指定标签在屏幕空间中距此标签原点的像素偏移量
      // pixelOffset: new Cartesian2(10, 0),
      // 应用于图像的统一比例。比例大于会1.0放大标签，而比例小于会1.0缩小标签。
      // scale: 1.0,
      // 显示在距相机的距离处的属性，多少区间内是可以显示的
      distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 1500),
      // 是否显示
      show: true,
    },
    label: {
      // 文本。支持显式换行符“ \ n”
      text: point.empname,
      // 字体样式，以CSS语法指定字体
      font: "8pt Source Han Sans CN",
      // 字体颜色
      fillColor: new Cesium.Color("#FFF"),
      // 背景颜色
      backgroundColor: Cesium.Color.fromCssColorString("0, 0, 0, 0.6"),
      // 是否显示背景颜色
      showBackground: true,
      // 字体边框
      outline: true,
      // 字体边框颜色
      outlineColor: Cesium.Color.WHITE,
      // 字体边框尺寸
      outlineWidth: 0,
      // 应用于图像的统一比例。比例大于会1.0放大标签，而比例小于会1.0缩小标签。
      scale: 1.0,
      // 设置样式：FILL：填写标签的文本，但不要勾勒轮廓；OUTLINE：概述标签的文本，但不要填写；FILL_AND_OUTLINE：填写并概述标签文本。
      style: Cesium.LabelStyle.FILL_AND_OUTLINE,
      // 相对于坐标的水平位置
      verticalOrigin: Cesium.VerticalOrigin.TOP,
      // 相对于坐标的水平位置
      // horizontalOrigin: HorizontalOrigin.CENTER,
      // 该属性指定标签在屏幕空间中距此标签原点的像素偏移量
      // pixelOffset: new Cartesian2(0, -52),
      //eyeOffset: new Cartesian3(0, 0, -10),
      disableDepthTestDistance: Number.POSITIVE_INFINITY, //透视效果
      // 是否显示
      distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 1500),
      show: true,
    },
    show: true,
  };
  let people = viewer.entities.add(entityOption);
  peopleMap.set(point.iccard, people);
  // entity = viewer.entities.add(entityOption);
  // viewer.trackedEntity = entity;
  viewer.clock.startTime = start.clone();
  viewer.clock.currentTime = start.clone();
  viewer.clock.clockRange = Cesium.ClockRange.CLAMPED;
  viewer.clock.shouldAnimate = false;
};
const getPosition = (time, point) => {
  if (viewer.clock.shouldAnimate == false) {
    viewer.clock.shouldAnimate = true;
  }
  const position = Cesium.Cartesian3.fromDegrees(
    point.longitude,
    point.latitude,
    0
  );
  const nextTime = Cesium.JulianDate.addSeconds(
    lastTime[point.iccard],
    time + 0.1,
    new Cesium.JulianDate()
  );
  positionProperties[point.iccard].addSample(nextTime, position);
  lastTime[point.iccard] = nextTime;
};
let i = 0;
const initMap = () => {
  viewer = new Cesium.Viewer("map", {
    orderIndependentTranslucency: false,
    contextOptions: {
      webgl: {
        alpha: true,
      },
    },
    infoBox: false,
    selectionIndicator: false,
    geocoder: false, // 位置查找工具
    homeButton: false, // 视角返回初始位置
    sceneModePicker: true, // 选择视角的模式（球体、平铺、斜视平铺）
    baseLayerPicker: false, // 图层选择器（地形影像服务）
    navigationHelpButton: false, // 导航帮助(手势，鼠标)
    animation: false, // 左下角仪表盘（动画器件）
    timeline: false, // 底部时间线
    fullscreenButton: false, // 全屏
    vrButton: false, // VR,
    imageryProvider: new Cesium.UrlTemplateImageryProvider({
      url: "",
    }),
  });
  viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
    Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
  );
  viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
    Cesium.ScreenSpaceEventType.LEFT_CLICK
  );
  viewer._cesiumWidget._creditContainer.style.display = "none";
  viewer.sceneModePicker.container.style.display = "none";
  viewer.scene.skyBox.show = false;
  viewer.scene.backgroundColor = new Cesium.Color(0.0, 0.0, 0.0, 0.0);
  let url =
    "http://10.59.30.132:8889/榆林天然气有限公司大数据3Dtiles调整6-21/榆林3dtiles6-21/tileset.json";
  let palaceTileset = new Cesium.Cesium3DTileset({
    url: url,
    //控制切片视角显示的数量，可调整性能
    maximumScreenSpaceError: 2,
    maximumNumberOfLoadedTiles: 100000,
    preloadFlightDestinations: true,
  });
  console.log(palaceTileset);
  viewer.scene.primitives.add(palaceTileset);
  viewer.scene.globe.show = false;
  viewer.camera.flyTo({
    destination: Cesium.Cartesian3.fromDegrees(109.541, 38.27, 550),
    orientation: {
      heading: 6.094569844815272,
      pitch: -0.8070965146316187,
      roll: 0,
    },
    pitchAdjustHeight: 100,
  });
  setPersonnel();
};
const setPersonnel = () => {
  getRealInformation();
  personnel = setInterval(() => {
    if (i == 80) {
      ResetPeople();
      i = 0;
    }
    getRealInformation();
    i++;
  }, time * 1000);
};
const ResetPeople = () => {
  for (let key of peopleMap.values()) {
    viewer.entities.remove(key);
  }
  positionProperties = {};
  peopleMap = new Map();
};
const colorAtionRemoveAll = () => {
  for (let key of polygonList.values()) {
    viewer.entities.remove(key);
  }
  polygonList = new Map();
  for (let key of videoMap.values()) {
    viewer.entities.remove(key);
  }
  videoMap = new Map();
  clearInterval(personnel);
  for (let key of peopleMap.values()) {
    viewer.entities.remove(key);
  }
  positionProperties = {};
  peopleMap = new Map();
};
function videoPointFn() {
  var data = [
    {
      id: 4,
      videoCode: 24,
      pointNo: "1",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 1528.1,
      pointXY: null,
      pointY: 3504.6,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53827023085819,
      latitude: 38.274374549621434,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 5,
      videoCode: 23,
      pointNo: "2",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 1386.25,
      pointXY: null,
      pointY: 3282.75,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53816078122497,
      latitude: 38.27450694437033,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 7,
      videoCode: 22,
      pointNo: "3",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 1554.4,
      pointXY: null,
      pointY: 2959,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53828550681116,
      latitude: 38.274702839620595,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 8,
      videoCode: 21,
      pointNo: "4",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 1773.75,
      pointXY: null,
      pointY: 2895.85,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53845128121102,
      latitude: 38.274742387699014,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 9,
      videoCode: 20,
      pointNo: "5",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 2010.6000000000001,
      pointXY: null,
      pointY: 2629.6,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53862858778228,
      latitude: 38.274904197232615,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 10,
      videoCode: 18,
      pointNo: "6",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 3985,
      pointXY: null,
      pointY: 2366.5,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54012335693919,
      latitude: 38.27507656688678,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 11,
      videoCode: 19,
      pointNo: "7",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 3644.9999999999995,
      pointXY: null,
      pointY: 2256.5,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53986462345775,
      latitude: 38.2751402793298,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 12,
      videoCode: 10,
      pointNo: "8",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 3013.75,
      pointXY: null,
      pointY: 1506.5000000000002,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53937958774995,
      latitude: 38.275586773931124,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 13,
      videoCode: 9,
      pointNo: "9",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 1978.75,
      pointXY: null,
      pointY: 1516.5,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53859492121802,
      latitude: 38.27557334167342,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 14,
      videoCode: 7,
      pointNo: "10",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 1351.25,
      pointXY: null,
      pointY: 1594.6000000000001,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53811980938706,
      latitude: 38.27552187774216,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 15,
      videoCode: 8,
      pointNo: "11",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 820,
      pointXY: null,
      pointY: 1804,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53771879836968,
      latitude: 38.27539214527062,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 16,
      videoCode: 6,
      pointNo: "12",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 1350,
      pointXY: null,
      pointY: 1531.5000000000002,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53811832208972,
      latitude: 38.27555981453713,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 17,
      videoCode: 5,
      pointNo: "13",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 440,
      pointXY: null,
      pointY: 1001.5000000000001,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.53742381516675,
      latitude: 38.275872012129355,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 18,
      videoCode: 11,
      pointNo: "14",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 3945,
      pointXY: null,
      pointY: 1429,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54008501237381,
      latitude: 38.27564005426459,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 19,
      videoCode: 12,
      pointNo: "15",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 4771.25,
      pointXY: null,
      pointY: 1426.5,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54071146575106,
      latitude: 38.27564748005246,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 20,
      videoCode: 17,
      pointNo: "16",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 5727.5,
      pointXY: null,
      pointY: 2619.6000000000004,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54144670985502,
      latitude: 38.27493685279867,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 21,
      videoCode: 13,
      pointNo: "17",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 5262.5,
      pointXY: null,
      pointY: 1326.5,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54108308359928,
      latitude: 38.275711137134444,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 22,
      videoCode: 16,
      pointNo: "18",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 6163.75,
      pointXY: null,
      pointY: 1357.75,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54176669164148,
      latitude: 38.275698804639674,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 23,
      videoCode: 15,
      pointNo: "19",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 7137.5,
      pointXY: null,
      pointY: 995.2500000000001,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54250190352353,
      latitude: 38.27592377692765,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
    {
      id: 24,
      videoCode: 14,
      pointNo: "20",
      ip: "",
      workshopId: null,
      layer: null,
      type: 0,
      pointX: 7097.5,
      pointXY: null,
      pointY: 906.5000000000001,
      pointYY: null,
      imgW: 7671,
      imgWY: null,
      imgH: 4539,
      imgHY: null,
      branchID: null,
      imgId: null,
      longitude: 109.54247081609593,
      latitude: 38.27597686082968,
      picW: 7671,
      picH: 4539,
      cameraType: 1,
      category: 1,
      url: "",
      playback: null,
      defaultShow: null,
      judgmentState: null,
      workname: null,
      warnList: null,
    },
  ];
  for (var i in data) {
    if (data[i].latitude && data[i].longitude) {
      let resourImg = "./images/videoIcon.png";

      let sps = getAreaFloorSpacing(data[i].workshopId, data[i].layer);
      let floorSpacing;
      let Spacing;
      if (sps == null) {
        let _fl = data[i].layer ? data[i].layer : 1;
        let _lay = parseInt(_fl);
        floorSpacing = floorTmepHeight * (_lay - 1);
      } else {
        floorSpacing = parseInt(sps) != NaN ? parseInt(sps) : 0;
      }
      Spacing = memberFloorHeight + floorSpacing;
      //console.log(Spacing);
      try {
        let cameraType = data[i].cameraType;
        resourImg =
          cameraType == 1 ? "./images/videoIcon.png" : "./images/videoBk.png";
      } catch (e) {}
      var videoListIconsid = viewer.entities.add({
        id: data[i].videoCode + "_Video",
        position: Cesium.Cartesian3.fromDegrees(
          data[i].longitude,
          data[i].latitude,
          Spacing
        ),
        type: "100123456",
        cameraIndexCodenums: data[i].pointNo,
        dataMens: data[i],
        show: true,
        label: {
          // 文本。支持显式换行符“ \ n”
          text: data[i].layer + "F",
          // 字体样式，以CSS语法指定字体
          font: "10pt Source Han Sans CN",
          // 字体颜色
          fillColor: Cesium.Color.WHITE,
          // 背景颜色
          backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
          // 是否显示背景颜色
          showBackground: true,
          // 字体边框
          outline: true,
          // 字体边框颜色
          outlineColor: Cesium.Color.WHITE,
          // 字体边框尺寸
          outlineWidth: 1,
          // 应用于图像的统一比例。比例大于会1.0放大标签，而比例小于会1.0缩小标签。
          scale: 1.0,
          // 设置样式：FILL：填写标签的文本，但不要勾勒轮廓；OUTLINE：概述标签的文本，但不要填写；FILL_AND_OUTLINE：填写并概述标签文本。
          style: Cesium.LabelStyle.FILL_AND_OUTLINE,
          // 相对于坐标的水平位置
          verticalOrigin: Cesium.VerticalOrigin.CENTER,
          // 相对于坐标的水平位置
          horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
          // 该属性指定标签在屏幕空间中距此标签原点的像素偏移量
          pixelOffset: new Cesium.Cartesian2(0, -45),
          eyeOffset: new Cesium.Cartesian3(0, 0, 10),
          disableDepthTestDistance: Number.POSITIVE_INFINITY,
          // 是否显示
          show: data[i].layer ? true : false,
        },
        billboard: {
          //图标
          image: resourImg,
          width: 50,
          height: 62,
          disableDepthTestDistance: Number.POSITIVE_INFINITY, //透视效果
        },
      });
      videoListIcons.push(videoListIconsid);
      videoListIconsid.pointData = data[i];
      videoMap.set(data[i].id, videoListIconsid);
    }
  }
  handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
  handler.setInputAction((movement) => {
    var scene = viewer.scene;
    var pickedObject = scene.pick(movement.position);
    var cartesian = viewer.scene.pickPosition(movement.position);
    if (pickedObject.id) {
      code.value = pickedObject.id._id.split("_")[0];
      centerDialogVisible.value = true;
    }
  }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}
function getAreaFloorSpacing(id, layer) {
  //默认设置高度为
  for (var i in floorsopList) {
    if (id == floorsopList[i].shopid && layer == floorsopList[i].floor) {
      var heigt = floorsopList[i].spacing;
      if (heigt) {
        return heigt == 0 ? heigt : heigt;
      } else {
        return null;
      }
    }
  }
  return null;
}
onMounted(() => {
  document.addEventListener("visibilitychange", function () {
    if (document.visibilityState == "hidden") {
      //切离该页面时执行
    } else if (document.visibilityState == "visible") {
      //切换到该页面时执行
      ResetPeople();
      getRealInformation();
    }
  });
  initMap();
});

defineExpose({
  getAreaPointFn,
  videoPointFn,
  setPersonnel,
  colorAtionRemoveAll,
});

onBeforeUnmount(() => {
  viewer = null;
});
</script>

<template>
  <div id="map"></div>
  <el-dialog
    class="modal"
    v-model="centerDialogVisible"
    width="70%"
    destroy-on-close
  >
    <iframe
      :src="'./video.html?code=' + code"
      frameborder="0"
      width="100%"
      height="100%"
    ></iframe>
  </el-dialog>
</template>

<style scoped>
#map {
  position: absolute;
  width: 100%;
  height: 100%;
}

:deep(.cesium-viewer-toolbar) {
  display: none;
}
</style>
